package com.umpay.junit.test.xcx.dh;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.junit.Test;

import com.umfwechat.common.prop.UmfPropModel;
import com.umfwechat.util.EmailXmlUtil;
import com.umfwechat.util.StringUtil;
import com.umfwechat.util.email.MailSenderInfo;
import com.umfwechat.util.email.SendMailUtil;
import com.umfwechat.util.fileDownLoad.CaFilter;
import com.umpay.junit.test.xcx.SafeLayerSign;

public class SendEeail {
	@Test
	public void send() throws UnsupportedEncodingException, Exception{
		Long startTime = System.currentTimeMillis();
		
		String url="http://127.0.0.1:8080/umfWeChatPlat/merchantDeploy/sendEmail";
        HttpClient client = new DefaultHttpClient();   
        SafeLayerSign st= new SafeLayerSign();
        JSONObject json=new JSONObject();
     
        json.put("loginToken", "55005051-038d-43f2-8349-8160a48ade7f");
        json.put("loginUserId", "ddf");
        json.put("loginAgentId", "Y669621624");
//        json.put("loginAgentId", "E188331683");
        json.put("agentId", "Y575563672");//userId:代理商编号
        HttpPost post =  st.sign(json,url);
        JSONObject response = null;    
        try {       
           HttpResponse httpResponse = client.execute(post);  
           InputStream inStream =     httpResponse.getEntity().getContent();  
           BufferedReader reader = new BufferedReader(new InputStreamReader(inStream,"utf-8"));    
           StringBuilder strber = new StringBuilder();    

           String line = null;    
           while ((line = reader.readLine()) != null)     
               strber.append(line + "\n");    
           inStream.close(); 
           System.out.println(strber);
         } catch (Exception e) {    
             throw new RuntimeException(e);    
         }    
		
	}

}
